package com.ruoyi.system.service.impl.user;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.user.VsDramasUserBankMapper;
import com.ruoyi.system.domain.user.VsDramasUserBank;
import com.ruoyi.system.service.user.IVsDramasUserBankService;

/**
 * 提现银行卡Service业务层处理
 * 
 * @author zzx
 * @date 2024-04-30
 */
@Service
public class VsDramasUserBankServiceImpl implements IVsDramasUserBankService 
{
    @Autowired
    private VsDramasUserBankMapper vsDramasUserBankMapper;

    /**
     * 查询提现银行卡
     * 
     * @param id 提现银行卡主键
     * @return 提现银行卡
     */
    @Override
    public VsDramasUserBank selectVsDramasUserBankById(Long id)
    {
        return vsDramasUserBankMapper.selectVsDramasUserBankById(id);
    }

    /**
     * 查询提现银行卡列表
     * 
     * @param vsDramasUserBank 提现银行卡
     * @return 提现银行卡
     */
    @Override
    public List<VsDramasUserBank> selectVsDramasUserBankList(VsDramasUserBank vsDramasUserBank)
    {
        return vsDramasUserBankMapper.selectVsDramasUserBankList(vsDramasUserBank);
    }

    /**
     * 新增提现银行卡
     * 
     * @param vsDramasUserBank 提现银行卡
     * @return 结果
     */
    @Override
    public int insertVsDramasUserBank(VsDramasUserBank vsDramasUserBank)
    {
        VsDramasUserBank bank = new VsDramasUserBank();
        bank.setUserId(vsDramasUserBank.getUserId());
        bank.setType(vsDramasUserBank.getType());
        VsDramasUserBank userBank = vsDramasUserBankMapper.selectUserBankByParams(bank);
        long l = System.currentTimeMillis();
        if (userBank != null) {
            vsDramasUserBank.setId(userBank.getId());
            vsDramasUserBank.setUpdatetime(l);
            return vsDramasUserBankMapper.updateVsDramasUserBank(vsDramasUserBank);
        }
        vsDramasUserBank.setCreatetime(l);
        vsDramasUserBank.setUpdatetime(l);
        return vsDramasUserBankMapper.insertVsDramasUserBank(vsDramasUserBank);
    }

    /**
     * 修改提现银行卡
     * 
     * @param vsDramasUserBank 提现银行卡
     * @return 结果
     */
    @Override
    public int updateVsDramasUserBank(VsDramasUserBank vsDramasUserBank)
    {
        vsDramasUserBank.setUpdatetime(System.currentTimeMillis());
        return vsDramasUserBankMapper.updateVsDramasUserBank(vsDramasUserBank);
    }

    /**
     * 批量删除提现银行卡
     * 
     * @param ids 需要删除的提现银行卡主键
     * @return 结果
     */
    @Override
    public int deleteVsDramasUserBankByIds(Long[] ids)
    {
        return vsDramasUserBankMapper.deleteVsDramasUserBankByIds(ids);
    }

    /**
     * 删除提现银行卡信息
     * 
     * @param id 提现银行卡主键
     * @return 结果
     */
    @Override
    public int deleteVsDramasUserBankById(Long id)
    {
        return vsDramasUserBankMapper.deleteVsDramasUserBankById(id);
    }

    @Override
    public VsDramasUserBank selectUserBankByParams(VsDramasUserBank vsDramasUserBank) {
        return vsDramasUserBankMapper.selectUserBankByParams(vsDramasUserBank);
    }
}
